<template>
  <div id="app">
    <div class="text">测试</div>
    <button @click="changeTheme">改变主题</button>
    <router-view />

  </div>
</template>
<script>
export default {
  data() {
    return {
      dark: true
    }
  },
  methods: {
    changeTheme() {
      this.$nextTick(() => {
        let linkCss = document.querySelector('link#theme')
        if (this.dark) {
          linkCss.href = './style/lightTheme.css'
        } else {
          linkCss.href = './style/darkTheme.css'
        }

        this.dark = !this.dark

      })
    }
  }
}
</script>

<style lang="scss">
// @import "./style/darkTheme.css";
// @import "./style/lightTheme.css";

#app {
  width: 100vw;
  height: 100vh;
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: var(--clr);
  background-color: var(--bg);
}
</style>
